from enum import Enum
from typing import Optional


class EntityEnum(Enum):
    paper = (1, 'work')
    scholar = (2, 'author')
    venue = (3, 'source')
    org = (4, 'institution')
    concept = (5, 'concept')

    def __init__(self, value, open_alex_name: str):
        self._value_ = value
        self.es_name = open_alex_name

    def __str__(self):
        return self.name


def get_entity_enum_by_type_name(entity_name: str) -> Optional[EntityEnum]:
    for entity in EntityEnum:
        if entity.name == entity_name:
            return entity
    return None

